<?php require_once(dirname (__FILE__) . '/meta-boxes.php') ?>
<div class="wrap">
	<?php screen_icon( 'wvcf' ); ?>
	<?php if ( ! $cat->cat_id ): ?>
		<h2><?php _e("Add New Category") ?></h2>
	<?php else: ?>
		<h2><?php _e("Edit Category") ?></h2>
	<?php endif; ?>
	
	<?php if ( $notice ) : ?>
		<div id="notice" class="error"><p><?php echo $notice ?></p></div>
	<?php endif; ?>
	<?php if ( $message ) : ?>
		<div id="message" class="updated"><p><?php echo $message; ?></p></div>
	<?php endif; ?>
	
	<form action="admin.php?page=wvcf&mode=edit" method="post" accept-charset="utf-8" id="the_form">
	<?php wp_nonce_field( 'wvcf-form', '_category_submit_nonce' ); ?>
	<input type="hidden" name="id" value="<?php echo $cat->cat_id ?>">
	
	<div id="poststuff" class="metabox-holder has-right-sidebar">
		<!-- Right sidebar -->
		<div class="inner-sidebar" id="side-info-column">
			<div class="postbox" id="linksubmitdiv">
				<div title="Click to toggle" class="handlediv">
					<br>
				</div>
				<h3 class="hndle">
					<span><?php _e('Save') ?></span>
				</h3>
				<div class="inside">
					<div id="submitlink" class="submitbox">
						<div id="minor-publishing">
							<div id="minor-publishing-actions">
								<div id="preview-action"></div>
								<div class="clear"></div>
							</div>
							<div id="misc-publishing-actions">
								<div class="misc-pub-section misc-pub-section-last">
									<?php if ($cat->always_show == 1) $checked = 'checked'; ?>
									<label class="selectit" for="link_private"><input type="checkbox" value="1" name="always_show" id="always-show" <?php echo $checked ?>> <?php _e('Always show this category?') ?></label>
								</div>
							</div>
						</div>
						<div id="major-publishing-actions">
							<div id="delete-action"></div>
							<div id="publishing-action">
								<?php if ( ! $cat->cat_id ): ?>
								<input type="submit" value="<?php _e('Add') ?>" accesskey="p" tabindex="4" id="publish" class="button-primary" name="save">
								<?php else: ?>
								<input type="submit" value="<?php _e('Update') ?>" accesskey="p" tabindex="4" id="publish" class="button-primary" name="save">		
								<?php endif ?>
							</div>
							<div class="clear"></div>
						</div>
						<div class="clear"></div>
					</div>
				</div>
			</div>
		</div>
		
		<!-- The editor -->
		<div id="post-body">
			<div id="post-body-content">
				
				<div class="stuffbox" id="namediv">
					<h3><label for="category_name"><?php _e('Name') ?></label></h3>
					<div class="inside">
						<input type="text" id="category_name" value="<?php echo $cat->name ?>" tabindex="1" size="30" name="category_name">
					    <p><?php _e('Example: List Price, MLS # ...') ?></p>
					</div>
				</div>
				
				<div class="stuffbox" id="typediv">
					<h3><label for="category_type"><?php _e('Type') ?></label></h3>
					<div class="inside">
						<?php category_type_select($cat->type) ?>
					    <p><?php _e('You\'ll need to define <strong>options</strong> for Dropdown List') ?></p>
					</div>
				</div>
				
				<?php if ($cat->type != CF_TYPE_DROPDOWN) $hide = 'style="display: none;"'; ?>
				
				<div class="stuffbox" id="optiondiv" <?php echo $hide ?>>
					<h3><label for="option_value"><?php _e('Option values') ?></label></h3>
					<div class="inside">
						<table id="options-form" cellspacing="2" cellpadding="5" style="width: 100%;" class="form-table">
							<tbody>
								<?php 
								$index = 0;
								foreach ((array)$cat->options as $option): $index++; ?>
								<tr class="form-field">
									<th valign="top" scope="row"><label>Option <?php echo $index ?></label></th>
									<td><input type="text" name="options[]" value="<?php echo $option ?>"/></td>
								</tr>
								<?php endforeach ?>
								
								<?php while ($index < 3): $index++; ?>
								<tr class="form-field">
									<th valign="top" scope="row"><label>Option <?php echo $index ?></label></th>
									<td><input type="text" name="options[]" value=""/></td>
								</tr>
								<?php endwhile; ?>
							</tbody>
						</table>
						<span id="addmore" class="button"><?php _e('Add More Options') ?></span>
					</div>
				</div>
				
			</div>
		</div>
		
		<div class="clear"></div>
	</div>
	
	</form>

	
</div>